let vm = new Vue({
    el:'#app',  //选中整个main
    data:{
        users:{},
        depts:{}
    },
    methods:{
        //查所有用户
        selectAllUser:function(){
            axios.get(
                'user/selectAll'
            ).then(result=>{
                this.users=result.data.obj;
            }).catch(error=>{
                layer.msg(error.message);
            });
        },
        //查所有使用了的部门
        selectAllUsedDept:function(){
            axios.get(
                'dept/selectAllUsedDept'
            ).then(result=>{
                this.depts=result.data.obj;
            }).catch(error=>{
                layer.msg(error.message);
            });
        },
        todetail:function (user) {
            layer.obj = user;
            if (user.isSecret==0||(user.isSecret==1&&user.id==this.myId)){
                layer.open({
                    type: 2,
                    title: '详情',
                    maxmin: true,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['1000px', '80%'],
                    content: 'html/user_detail.html',
                });
            }else {
                layer.msg("对方已设置权限，您无权访问");
            }
        },
    },
    created:function () {
        this.selectAllUser();
        this.selectAllUsedDept();
    }
});